#include "stdafx.h"

#include "ImageManager.h"

namespace ETM
{
	namespace Resources
	{
		ImageManager IM;

		sf::Image* ImageManager::Load(const std::string &id)
		{
			sf::Image* image = new sf::Image();

			if(!image->LoadFromFile(id))
			{
				std::cout << "ImageManager failed to load: " << id << std::endl;
				delete image;
				image = NULL;
			}

			image->SetSmooth(smooth);

			if(createMask)
				image->CreateMaskFromColor(maskColor);

			return image;
		}

		void ImageManager::SetSmooth(bool smooth)
		{
			this->smooth = smooth;
		}

		void ImageManager::SetCreateMask(bool createMask)
		{
			this->createMask = createMask;
		}

		void ImageManager::SetMaskColor(sf::Color& maskColor)
		{
			this->maskColor = maskColor;
		}
	}
}